import Vue from 'vue'
import Router from 'vue-router'
// import HelloWorld from '@/components/HelloWorld'
import Login from '@/views/login/login'
import Layout from '@/views/layout/Layout'
import PcDashboard from '@/views/pc-download/index'
import DownloadList from '@/views/pc-download/product/productList'
import DownloadAdd from '@/views/pc-download/product/DownloadAdd'

import DepartmentList from '@/views/finance/department/department'
import BusinessList from '@/views/finance/department/business'
import PersonnelList from '@/views/finance/department/personnel'
import AddPersonnel from '@/views/finance/department/add'
import EditPersonnel from '@/views/finance/department/edit'

import MaterialPage from '@/views/pc-download/product/MaterialPage'
import LocalpackList from '@/views/pc-download/product/LocalpackList'
import ProlinkManage from '@/views/pc-download/product/ProlinkManage'
import ProlinkDetail from '@/views/pc-download/product/ProlinkDetail'
import PropackMap from '@/views/pc-download/product/PropackMap'
import OperationRecord from '@/views/pc-download/product/OperationRecord'
import BookmarksLink from '@/views/pc-download/product/BookmarksLink'
import ProductEditor from '@/views/pc-download/product/ProductEditor'
import ProductInfo from '@/views/pc-download/product/ProductInfo'
// 以下下载器数据分析
import DataDownlaoder from '@/views/pc-download/data-downloader/index'
import DownloaderDeatil from '@/views/pc-download/data-downloader/DownloaderDetail'
import ProUnitprice from '@/views/pc-download/data-downloader/ProUnitprice'

Vue.use(Router)
// 定义不变的路由
export const constantRouterMap = [
  {
    path: '/login',
    name: 'login',
    component: Login
  },
  {
    path: '',
    component: Layout,
    children: [{
      path: 'dashboard',
      component: PcDashboard,
      name: 'dashboard',
      meta: { title: 'dashboard', icon: 'dashboard', noCache: true }
    }]
  },
  {
    path: '/finance',
    name: 'Department',
    component: Layout,
    children: [
      {
        path: 'department',
        name: '部门列表',
        component: DepartmentList
      },
      {
        path: 'personnel',
        name: '人员列表',
        component:PersonnelList
      },
      {
       path:'business',
       name:'业务列表',
       component:BusinessList
     },
     {
      path:'add',
      name:'添加人员',
      component:AddPersonnel
    },
    {
     path:'edit',
     name:'编辑人员',
     component:EditPersonnel
   }
    ]
  },
  {
    path: '/pcproduct',
    component: Layout,
    redirect: 'noredirect',
    meta: {
      title: '产品管理',
      icon: '产品管理'
    },
    children: [
      {
        path: 'list',
        component: DownloadList,
        name: 'pclist',
        meta: { title: '产品列表', icon: '产品列表', noCache: true }
      },
      {
        path: 'add',
        component: DownloadAdd,
        name: '产品添加',
        meta: { title: '产品添加', icon: '产品添加', noCache: true }
      },
      {
        path: 'material',
        component: MaterialPage,
        name: 'material',
        meta: { title: '设置物料', icon: '设置物料', noCache: true }
      },
      {
        path: 'editor/:proId',
        component: ProductEditor,
        name: 'editor',
        meta: { title: '编辑产品', icon: '编辑产品', noCache: true }
      },
      {
        path: 'proinfo/:proId',
        component: ProductInfo,
        name: 'proinfo',
        meta: { title: '查看产品', icon: '查看产品', noCache: true }
      },
      {
        path: 'localpack',
        component: LocalpackList,
        name: 'localpack',
        meta: { title: '本地包列表', icon: '本地包列表', noCache: true }
      },
      {
        path: 'prolink/:proId',
        component: ProlinkManage,
        name: 'prolink',
        meta: {title: '产品链接管理', icon: '产品链接管理', noCache: true}
      },
      {
        path: 'prolinkdetail/:proId',
        component: ProlinkDetail,
        name: 'prolinkdetail',
        meta: {title: '查看产品链接', icon: '查看产品链接', noCache: true}
      },
      {
        path: 'propackmap',
        component: PropackMap,
        name: 'propackmap',
        meta: {title: '产品包分布明细', icon: '产品包分布明细', noCache: true}
      },
      {
        path: 'operationrecord/:proId',
        component: OperationRecord,
        name: 'operationrecord',
        meta: {title: '产品操作记录', icon: '产品操作记录', noCache: true}
      },
      {
        path: 'bookmarkslink',
        component: BookmarksLink,
        name: 'bookmarkslink',
        meta: {title: '收藏夹链接列表', icon: '收藏夹链接列表', noCache: true}
      }
    ]
  },
  {
    path: '/analyzexzq',
    component: Layout,
    redirect: 'noredirect',
    meta: {
      title: '下载器数据分析'
    },
    children: [
      {
        path: 'index',
        component: DataDownlaoder,
        name: 'xzqindex',
        meta: { title: '下载器分析', icon: '下载器分析', noCache: true }
      },
      {
        path: 'detail',
        component: DownloaderDeatil,
        name: 'xzqdetail',
        meta: { title: '下载器明细分析', icon: '下载器明细分析', noCache: true }
      },
      {
        path: 'unitprice',
        component: ProUnitprice,
        name: 'xzqunitprice',
        meta: { title: '成功单价统计', icon: '成功单价统计', noCache: true }
      }
    ]
  }
]

export default new Router({
  // mode: 'history', // require service support
  // scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
// 定义权限控制的路由
export const asyncRouterMap = [
  {
    path: '/pcdashboard',
    component: Layout,
    children: [{
      path: 'index',
      component: PcDashboard,
      name: '下载器首页',
      meta: { title: '下载器首页', icon: '下载器首页', noCache: true }
    }]
  }
]
